home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / dev / lang / bcpl4amiga.lha / bcpl / icint.h < prev    next >
C/C++ Source or Header  |  1991-02-03  |  2KB  |  116 lines

  1. #ifndef    unix
  2. #define    cware
  3. /* or c80 */
  4. #endif
  5.  
  6. #ifndef    EXT
  7. #define    EXT    extern
  8. #endif
  9.  
  10. #ifdef    unix
  11. #include    <stdio.h>
  12. typedef    FILE    *FP;
  13. /* standard stream numbers */
  14. #define    S_IN        1
  15. #define    S_OUT        2
  16. #define    S_ERR        3
  17. #endif
  18.  
  19. #ifdef    cware
  20. #include    <stdio.h>
  21. typedef    int    FP;
  22. EXT int    S_IN, S_OUT, S_ERR;
  23. #endif
  24.  
  25. #ifdef    c80
  26. #define    EOF    -1
  27. #define    NULL    0
  28. #define    FP    int
  29. EXT int    S_IN, S_OUT, S_ERR;
  30. EXT int    stdin, stdout, stderr;
  31. #include    "printf.h"
  32. #endif
  33.  
  34. /* fundamental constants */
  35. #define    CHARWORDBITS    16
  36. #define    BYTESIZE    8
  37. #define    MAXFN        16        /* max length of filenames */
  38.  
  39. /* default memory allocation */
  40. #define    PROGMAX        21000
  41. #define    GLOBMAX        400
  42. #define    LABMAX        500
  43.  
  44. /* Intcode instructions */
  45. #define    OP_L        0
  46. #define    OP_S        1
  47. #define    OP_A        2
  48. #define    OP_J        3
  49. #define    OP_T        4
  50. #define    OP_F        5
  51. #define    OP_K        6
  52. #define    OP_X        7
  53.  
  54. /* codeword layout */
  55. #define    FSHIFT        12
  56. #define    DBIT        (1<<15)
  57. #define    IBIT        (1<<10)
  58. #define    GBIT        (1<<9)
  59. #define    PBIT        (1<<8)
  60. #define    ABITS        ((1<<8)-1)
  61.  
  62. /* some initial instructions */
  63. #ifdef    unix
  64. #define    op(x)        (x<<FSHIFT)
  65. #define    LIG1        (op(OP_L)|IBIT|GBIT|1)
  66. #define    K2        (op(OP_K)|2)
  67. #define    X22        (op(OP_X)|22)
  68. #define    X100        (op(OP_X)|100)
  69. #endif
  70.  
  71. #ifdef    cware
  72. #define    op(x)        (x<<FSHIFT)
  73. #define    LIG1        (op(OP_L)|IBIT|GBIT|1)
  74. #define    K2        (op(OP_K)|2)
  75. #define    X22        (op(OP_X)|22)
  76. #define    X100        (op(OP_X)|100)
  77. #endif
  78.  
  79. #ifdef    c80
  80. /* gee what a stupid macro processor */
  81. #define    LIG1        ((OP_L<<FSHIFT)|IBIT|GBIT|1)
  82. #define    K2        ((OP_K<<FSHIFT)|2)
  83. #define    X22        ((OP_X<<FSHIFT)|22)
  84. #define    X100        ((OP_X<<FSHIFT)|100)
  85. #endif
  86.  
  87. #ifdef    unix
  88. typedef    short    word;
  89. #endif
  90.  
  91. #ifdef    cware
  92. typedef    short    word;
  93. #endif
  94.  
  95. #ifdef    c80
  96. #define    word    short
  97. #define    unsigned
  98. /* apparently asm mnemonics cannot be used as vars, how silly */
  99. #define    cp    ccp
  100. #define    stc    storec
  101. /* why they want to be non-standard I don't know */
  102. #define    malloc    alloc
  103. #endif
  104.  
  105. EXT int    ch, cp;
  106. EXT int    MAXMEM;
  107. EXT word    *mem;
  108. EXT int    progvec, globvec, labvec;
  109. EXT int    pp, gp;
  110. EXT int    cyclecount, linecount;
  111.  
  112. #ifdef    profiling
  113. EXT int    majinstr[8];
  114. EXT int    mininstr[38];
  115. #endif
  116.